<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>业务管理</title>
	<meta name="decorator" content="default"/>
    <style>
        .table-striped tbody>tr:nth-child(odd)>td, .table-striped tbody>tr:nth-child(odd)>th {
            background: none !important;
        }

    </style>
	<script type="text/javascript">
		$(document).ready(function() {
            $("#btnExport").click(function(){
                top.$.jBox.confirm("确认要导出报警用户数据吗？","系统提示",function(v,h,f){
                    if(v=="ok"){
                        $("#searchForm").attr("action","${ctx}/sys/firm/firm/export");
                        $("#searchForm").submit();
                    }
                },{buttonsFocus:1});
                top.$('.jbox-body .jbox-icon').css('top','55px');
            });
			$(".bianji").click(function () {
				var id = $(this).data("id");
				var static = $(this).data("static");

				if(static == '1' || static == '2'){
                    layer.open({
                        type: 2,
                        title:"回访信息录入",
                        skin: 'layui-layer-rim', //加上边框
                        offset: ['50px', '100px'],
                        area: ['900px', '90%'], //宽高
                        content: "${ctx}/sys/firm/firm/huifang?id="+id
                    });
				}
                if(static == '3'){
                    layer.open({
                        type: 2,
                        title:"受理信息录入",
                        skin: 'layui-layer-rim', //加上边框
                        offset: ['50px', '100px'],
                        area: ['900px', '500px'], //宽高
                        content: "${ctx}/sys/firm/firm/shouli?id="+id
                    });
                }
                if(static == '4' || static == '5'){
                    layer.open({
                        type: 2,
                        title:"结案信息录入",
                        skin: 'layui-layer-rim', //加上边框
                        offset: ['50px', '100px'],
                        area: ['900px', '500px'], //宽高
                        content: "${ctx}/sys/firm/firm/jiean?id="+id
                    });
                }
            })
			$(".xinxi").click(function () {
				var id = $(this).data("id");
                layer.open({
                    type: 2,
                    title:"客户详细信息",
                    skin: 'layui-layer-rim', //加上边框
                    offset: ['50px', '100px'],
                    area: ['900px', '90%'], //宽高
                    content: "${ctx}/sys/firm/firm/xinxi?id="+id
                });
            })
            $(".remark").click(function () {
                var id = $(this).data("id");
                layer.open({
                    type: 2,
                    title:"备注信息修改",
                    skin: 'layui-layer-rim', //加上边框
                    offset: ['50px', '100px'],
                    area: ['800px', '80%'], //宽高
                    content: "${ctx}/sys/firm/firm/remark?id="+id
                });
            })
            $(".tbxx").click(function () {
                var id = $(this).data("id");
                layer.open({
                    type: 2,
                    title:"投保信息查看",
                    skin: 'layui-layer-rim', //加上边框
                    offset: ['50px', '100px'],
                    area: ['800px', '60%'], //宽高
                    content: "${ctx}/sys/firm/firm/tbxx?id="+id
                });
            })
            $(".chuxx").click(function () {
                var id = $(this).data("id");
                layer.open({
                    type: 2,
                    title:"出险信息查看",
                    skin: 'layui-layer-rim', //加上边框
                    offset: ['50px', '100px'],
                    area: ['800px', '60%'], //宽高
                    content: "${ctx}/sys/firm/firm/chuxx?id="+id
                });
            })
            $(".sbzd").click(function () {
                var id = $(this).data("id");
                layer.open({
                    type: 2,
                    title:"伤病诊断查看",
                    skin: 'layui-layer-rim', //加上边框
                    offset: ['50px', '100px'],
                    area: ['800px', '60%'], //宽高
                    content: "${ctx}/sys/firm/firm/sbzd?id="+id
                });
            })
            $(".officeId").click(function () {
                var name = $(this).data("name");
                layer.open({
                    type: 2,
                    title:"机构数据统计",
                    skin: 'layui-layer-rim', //加上边框
                    offset: ['50px', '100px'],
                    area: ['600px', '80%'], //宽高
                    content: "${ctx}/sys/firm/firm/tonJi?officeId="+name
                });
            })
            $("#btnRestart").click(function () {
                $('#memberName').val("");
                $('#officeId').val("");
                $('#officeName').val("");
                $('#qd').val("");
                $("#ywStatic").val("");
                $("#shou").val("");
                $('#btnSubmit').click();
            })
            $("body").keydown(function() {
                if (event.keyCode === "13") {//keyCode=13是回车键
                    $('#btnSumit').click();
                }
            });
        });
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
            $("#searchForm").attr("action","${ctx}/sys/firm/firm/");
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/firm/firm/">业务列表</a></li>
		<%--<shiro:hasPermission name="sys:firm:firm:edit"><li><a href="${ctx}/sys/firm/firm/form">业务添加</a></li></shiro:hasPermission>--%>
	</ul>
	<form:form id="searchForm" modelAttribute="firm" action="${ctx}/sys/firm/firm/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>客户姓名：</label>
				<form:input path="memberName" htmlEscape="false" maxlength="64" class="input-small"/>
			</li>
			<li><label>地区：</label>
				<sys:treeselect  id="office" name="office.id" value="${firm.office.id}" labelName="office.name" labelValue="${firm.office.name}"
								title="部门" url="/sys/office/treeData?type=2" cssClass="input-small" allowClear="true" notAllowSelectParent="true"/>
			</li>
			<li><label>渠道：</label>
				<form:select path="qd" class="input-small">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('qd_static')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li><label>状态：</label>
				<form:select path="ywStatic" class="input-small">
					<form:option value="" label=""/>
					<form:option value="2" label="报案未回访"/>
					<form:option value="3" label="已回访待受理"/>
					<form:option value="4" label="已受理"/>
					<%--<form:option value="5" label="超期未结案"/>--%>
					<form:option value="6" label="已结案"/>
					<form:option value="7" label="已撤件"/>
					<%--<form:options items="${fns:getDictList('business_static')}" itemLabel="label" itemValue="value" htmlEscape="false"/>--%>
				</form:select>
			</li>
			<%--<li><label>倒计时结案：</label>--%>
				<%--<form:input path="shou" htmlEscape="false" maxlength="2" class="input-small"/>--%>
			<%--</li>--%>
			<li class="btns">
                <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" onclick="return page();"/>
                <input id="btnRestart" class="btn btn-primary" type="button" value="重置"/>
                <shiro:hasPermission name="sys:firm:firm:daochu"><input id="btnExport" class="btn btn-primary" type="button" value="导出"/></shiro:hasPermission>
            </li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<shiro:hasPermission name="sys:firm:firm:edit"><th>操作</th></shiro:hasPermission>
				<th>机构</th>
				<th>渠道</th>
				<th>理赔号</th>
				<th>客户姓名</th>
                <th>案件难易</th>
                <th>申请类型</th>
                <th>出险日期</th>
                <th>报案日期</th>
                <th>生效日期</th>
				<th>投保信息</th>
				<th>出险信息</th>
				<th>伤病诊断</th>
				<th>状态</th>
				<th>出险时效</th>
				<th>受理时效</th>
				<th>备注信息</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="firm">
			<tr>
				<shiro:hasPermission name="sys:firm:firm:edit"><td>
					<a href="javascript:void(0)" class="bianji" data-id="${firm.id}" data-static=${firm.ywStatic}>编辑</a>
                    <shiro:hasPermission name="sys:firm:firm:gai"><a href="${ctx}/sys/firm/firm/xiugai?id=${firm.id}">修改</a></shiro:hasPermission>
                    <shiro:hasPermission name="sys:firm:firm:del"><a href="${ctx}/sys/firm/firm/delete?id=${firm.id}" onclick="return confirmx('确认要删除该业务吗？', this.href)">删除</a></shiro:hasPermission>
				</td></shiro:hasPermission>
				<td><a href="javascript:void(0)" class="officeId" data-name = ${firm.office.id}>
					${firm.office.name}
                </a></td>
				<td>
						${fns:getDictLabel(firm.qd, 'qd_static', '')}
				</td>
				<td><a href="javascript:void(0)" class="xinxi" data-id = ${firm.id}>
						${firm.member.liId}
				</a></td>
				<td style="<c:choose>
                <c:when test="${firm.shou='10'}">color:red !important;</c:when>
                    <c:otherwise></c:otherwise>
                        </c:choose>"><a href="javascript:void(0)" class="xinxi" data-id = ${firm.id}>
					${firm.memberName}
				</a></td>
                <td>
                        ${fns:getDictLabel(firm.difficulty, 'jian_fu', '')}
                </td>
				<%--<td>--%>
					<%--${firm.kfName}--%>
				<%--</td>--%>
                <td>
                        ${fns:getDictLabel(firm.sqLei, 'sq_lei', '')}
                </td>
                <td>
                    <fmt:formatDate value="${firm.chuTime}" pattern="yyyy-MM-dd"/>
                </td>
                <td>
                    <fmt:formatDate value="${firm.member.baTime}" pattern="yyyy-MM-dd"/>
                </td>
                <td>
                    <fmt:formatDate value="${firm.sxTime}" pattern="yyyy-MM-dd"/>
                </td>
				<td><a href="#" href="javascript:void(0)" class="tbxx" data-id=${firm.id}>
                    <div style="white-space: nowrap;overflow:hidden;width:80px;height: 20px;">
                            ${firm.tbXinxi}
                    </div></a>
				</td>
				<td><a href="#" href="javascript:void(0)" class="chuxx" data-id=${firm.id}>
                    <div style="white-space: nowrap;overflow:hidden;width:80px;height: 20px;">
					${firm.chuXinxi}
                    </div></a>
				</td>
                <td><a href="#" href="javascript:void(0)" class="sbzd" data-id=${firm.id}>
                    <div style="white-space: nowrap;overflow:hidden;width:80px;height: 20px;">
                        ${firm.sbZd}
                    </div></a>
                </td>
				<td style="<c:choose>
                <c:when test="${firm.ywStatic=='1'}">color:#df7401 !important;</c:when>
                <c:when test="${firm.ywStatic=='2'}">color:#dfb801 !important;</c:when>
                <c:when test="${firm.ywStatic=='3'}">color:#2e71b5 !important;</c:when>
                <c:when test="${firm.ywStatic=='4'}">color:#1ABC9C !important; </c:when>
                <c:when test="${firm.ywStatic=='5'}">color:#46cfd1 !important;</c:when>
                <c:when test="${firm.ywStatic=='6'}">color:#e44dff !important;</c:when>
				<c:when test="${firm.ywStatic=='7'}">color:#E40000 !important;</c:when>
                    <c:otherwise></c:otherwise>
                        </c:choose>">
					${fns:getDictLabel(firm.ywStatic, 'business_static', '')}
				</td>
				<td>
						${firm.cxSx}
				</td>
				<td>
						${firm.slSx}
				</td>
				<td><a href="javascript:void(0)" class="remark" data-id=${firm.id}>
                    <div style="white-space: nowrap;overflow:hidden;width:100px;height: 20px;">
                        <c:if test="${not empty firm.anRemark}">${firm.anRemark}</c:if>
					<c:if test="${empty firm.anRemark}">${firm.huiRemark}</c:if>
                    </div>
				</a></td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>